package com.fr.chicken.controller;


import com.fr.chicken.annotation.Verification;
import com.fr.chicken.facade.base.BaseResponseDTO;
import com.fr.chicken.facade.request.CollectRequsetDTO;
import com.fr.chicken.facade.request.UpdateHouseLevelRequsetDTO;
import com.fr.chicken.facade.response.GetChickenFarmInfoResponseDTO;
import com.fr.chicken.service.ChickenFarmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/chickenFarm")
@Api(value = "/api-chickenFarm", description = "鸡场管理")
public class ChickenFarmController {

    @Autowired
    private ChickenFarmService chickenFarmService;

    @Verification
    @ApiOperation(value = "获取玩家鸡场信息", notes = "获取玩家鸡场信息")
    @RequestMapping(value = "/getChickenFarmInfo/{playId}", method = RequestMethod.GET, produces = "application/json")
    public GetChickenFarmInfoResponseDTO getChickenFarmInfo(@RequestHeader String accessToken, @PathVariable(value = "playId") @ApiParam(required = true, value = "玩家id") Long playId) {
        GetChickenFarmInfoResponseDTO response = chickenFarmService.getChickenFarmInfo(playId);
        return response;
    }

    @Verification
    @ApiOperation(value = "收集鸡蛋", notes = "收集鸡蛋")
    @RequestMapping(value = "/collectEgg/{playerId}", method = RequestMethod.POST, produces = "application/json")
    public BaseResponseDTO collectEgg(@RequestHeader String accessToken,@PathVariable(value = "playerId") @ApiParam(required = true, value = "用户id") Long playerId) {
        BaseResponseDTO response = chickenFarmService.collectEgg(playerId);
        return response;
    }

    @Verification
    @ApiOperation(value = "收集粪便", notes = "收集粪便")
    @RequestMapping(value = "/collectFeaces", method = RequestMethod.POST, produces = "application/json")
    public BaseResponseDTO collectFeaces(@RequestHeader String accessToken,@RequestBody @ApiParam(name = "json对象", value = "传入json格式", required = true) CollectRequsetDTO requset) {
        BaseResponseDTO response = chickenFarmService.collectFeaces(requset);
        return response;
    }

    @Verification
    @ApiOperation(value = "收集鸡毛", notes = "收集鸡毛")
    @RequestMapping(value = "/collectFeather", method = RequestMethod.POST, produces = "application/json")
    public BaseResponseDTO collectFeather(@RequestHeader String accessToken,@RequestBody @ApiParam(name = "json对象", value = "传入json格式", required = true) CollectRequsetDTO requset) {
        BaseResponseDTO response = chickenFarmService.collectFeather(requset);
        return response;
    }

    @Verification
    @ApiOperation(value = "升级鸡场", notes = "升级鸡场")
    @RequestMapping(value = "/updateHouseLevel", method = RequestMethod.POST, produces = "application/json")
    public BaseResponseDTO collectFeather(@RequestHeader String accessToken,@RequestBody @ApiParam(name = "json对象", value = "传入json格式", required = true) UpdateHouseLevelRequsetDTO requset) {
        BaseResponseDTO response = chickenFarmService.updateHouseLevel(requset);
        return response;
    }
}
